﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Text;
using GreatB2C.Utility;

namespace GreatB2C.Web.Manage.SystemSet.Shop
{
    public partial class ProducerGuide : Inherit.ManagePage
    {
        protected void Page_Load( object sender , EventArgs e )
        {
            if ( !IsPostBack )
            {
                StringBuilder sbScript = new StringBuilder( );
                sbScript.Append( "<ul>" + DataDefine.NewLine );
                sbScript.Append( "<li><a href=\"ProducerManage.aspx\" target=\"main_right\">所有厂家</a></</li>" + DataDefine.NewLine );
                Business.Dictionary dictBLL = new Business.Dictionary( );
                Model.Dictionary dictModel = dictBLL.ListByFieldName( DataDefine.Dictionary.ProducerType.ToString( ) );

                if ( dictModel != null )
                {
                    if ( dictModel.FieldValue.Trim( ) != "" )
                    {
                        int i=0;
                        // 格式 ： 选项名|是否启用值|默认值
                        string[] parts = dictModel.FieldValue.ToString( ).Split( '$' );
                        foreach ( string part in parts )
                        {
                            if ( part.IndexOf( "|" ) > 0 )
                            {
                                string[] choises  = part.Split( '|' );
                                if ( choises.Length == 3 )
                                {
                                    sbScript.Append( "<li><a href=\"javascript:\" onclick=\"OpenMainRightType('" + i.ToString( ) + "','" + choises[ 0 ] + "')\">" + choises[ 0 ] + "</a></li>" + DataDefine.NewLine );
                                }
                            }
                            i++;
                        }
                    }
                }

                sbScript.Append( "</ul>" + DataDefine.NewLine );
                lblCategory.Text = sbScript.ToString( );
            }
        }
    }
}
